package com.chencq.module.role.service.impl;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.chencq.core.dao.BaseDao;
import com.chencq.core.service.base.impl.BaseServiceImpl;
import com.chencq.module.role.entity.Role;
import com.chencq.module.role.service.RoleService;
import com.chencq.module.user.entity.User;

@Service
public class RoleServiceImpl extends BaseServiceImpl<Role>  implements RoleService {

	@Autowired
	private BaseDao<Role> roleDao;
	
	@Autowired
	private BaseDao<User> userDao;
	
	@Override
	public List<Role> getUserRoles(String username) {
		User user = userDao.getByHql("FROM User WHERE userName=" + username);
		String userId=null;
		if(null!=user){
			userId=user.getUserId();
		}
		List<Map> list=roleDao.findBySql("select r.* from sys_role r,sys_user_ref_role s where s.USERID='"+userId+"' and r.ROLEID=s.ROLEID ");
		
		return null;
	}
}
